﻿Imports BL.BL


Public Class frmRestaurarCopiaSeguridad

#Region "Métodos"

    Private Sub frmRestore_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        'cosmetica.
        With Me.cbCantPartes
            .Items.Add(1)
            .Items.Add(2)
            .Items.Add(3)
            .Items.Add(4)
            .SelectedIndex = 0
            .DropDownStyle = ComboBoxStyle.DropDownList
        End With
        Me.txtPathOrigen.Clear()

        'si hay falla de integridad de BD (tablas usuario_familia ó usuario_patente) - no seteamos patentes
        If frmPrincipal.integridad = True And frmPrincipal.usr.nick <> "suseas" Then
            'patentes del usuario logueado.
            Helper_FL.setearPermisos(frmPrincipal.usr, Me)
        End If

    End Sub


    Private Sub Aceptar_Click(sender As Object, e As EventArgs) Handles btnAceptar.Click
        Try
            Me.Cursor = System.Windows.Forms.Cursors.WaitCursor
            BackUpRestore_BL.Restore(Me.txtPathOrigen.Text.ToString, CInt(Me.cbCantPartes.SelectedItem))
        Catch ex As Exception
            MsgBox(ex.ToString)
            Exit Sub
        Finally
            Me.Cursor = System.Windows.Forms.Cursors.Default
        End Try
        MessageBox.Show("Se realizó el RESTORE..")
        Me.Close()
    End Sub


    Private Sub Salir_Click(sender As Object, e As EventArgs) Handles btnSalir.Click
        Me.Close()
        Me.Dispose()
    End Sub


    Private Sub SeleccionarPath_Click(sender As Object, e As EventArgs) Handles btnSeleccionarPath.Click
        Me.fdbRestore.ShowDialog()
        Me.txtPathOrigen.Text = Me.fdbRestore.SelectedPath
    End Sub


    Private Sub frmRestaurarCopiaSeguridad_KeyDown(sender As Object, e As KeyEventArgs) Handles MyBase.KeyDown
        If e.KeyCode = Keys.F1 Then
            Help.ShowHelp(Me, Application.StartupPath & "\ayuda_SEAS.chm", "restaurarcopiaderespaldo.htm")
        End If
    End Sub


#End Region


End Class

